package com.lingyue.commons.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * Created by IntelliJ IDEA.
 *
 * @Description: TODO
 * @Author: BaiJinhua
 * @Date: 2019/11/26 23:53
 * @See: com.lingyue.common.enums
 * @Version: 1.0
 * Copyright: Copyright (c) 2019
 */
public enum CustomerEnum {

    VEHICLE_OWNER("O","车主"),
    AFTERMARKET_CONTACTS("A","售后联系人"),
    BOTH("B","车主/售后联系人"),
    ;
    String value;
    String msg;

    CustomerEnum(String value, String msg) {
        this.value = value;
        this.msg = msg;
    }

    public String value() {
        return this.value;
    }

    public String msg() {
        return this.msg;
    }

    public static String getMsg(String value) {
        if (StringUtils.isEmpty(value)) {
            return "未知";
        }
        for (CustomerEnum item : CustomerEnum.values()) {
            if (item.value().equals(value)) {
                return item.msg();
            }
        }
        throw new IllegalStateException() ;
    }
}
